package com.qys.livesMall.shortVideo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qys.livesMall.shortVideo.model.dto.app.AppShortVideoCommentQueryDTO;
import com.qys.livesMall.shortVideo.model.dto.sys.SysShortVideoCommentsPageDTO;
import com.qys.livesMall.shortVideo.model.entity.H2ShortVideoComments;
import com.qys.livesMall.shortVideo.model.vo.app.AppShortVideoCommentVO;
import com.qys.livesMall.shortVideo.model.vo.sys.SysShortVideoCommentsVO;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 短视频评论 Mapper 接口
 * </p>
 *
 * @author dp
 * @since 2023-05-04
 */
public interface H2ShortVideoCommentsMapper extends BaseMapper<H2ShortVideoComments> {

    /**
     * 分页查询短视频评论信息
     *
     * @param page
     * @param queryDTO
     * @return
     */
    Page<SysShortVideoCommentsVO> pageBySystem(Page<SysShortVideoCommentsVO> page, @Param("queryDTO") SysShortVideoCommentsPageDTO queryDTO);

    /**
     * app分页查询用户评论信息
     *
     * @param objectPage
     * @param baseQuery
     * @return
     */
    Page<AppShortVideoCommentVO> pageByApp(Page<AppShortVideoCommentVO> objectPage, @Param("baseQuery") AppShortVideoCommentQueryDTO baseQuery);


    /**
     * 用户是否已点赞
     * @param commentId
     * @param userId
     * @return
     */
    int haveLiked(Long commentId, Long userId);

    /**
     * 保存点赞
     * @param commentId
     * @param userId
     */
    void saveLike(Long commentId, Long userId);

    H2ShortVideoComments getById(String id);

    void updateLikeById(String id, int like);

    void deleteLike(Long id, Long userId);
}
